import request from './request'

export const getRoles = (params) => {
  return request({
    url: '/roles',
    method: 'get',
    params
  })
}

export const deleteUser = (id) => {
  return request({
    url: `/roles/${id}`,
    method: 'delete'
  })
}

export const addUser = (data) => {
  return request({
    url: '/roles',
    method: 'post',
    data
  })
}

export const editUser = (data) => {
  return request({
    url: `roles/${data.id}`,
    method: 'put',
    data
  })
}

export const delUsePower = (id, rid) => {
  return request({
    url: `roles/${id}/rights/${rid}`,
    method: 'delete'
  })
}

export const getPower = (type) => {
  return request({
    url: `/rights/${type}`,
    method: 'get'
  })
}
